﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BookSpider.Common
{
    public static class StringExtenstion
    {
        public static IEnumerable<T> Explode<T>(this string v)
        {
            if (v == null)
            {
                return null;
            }
            if (string.IsNullOrWhiteSpace(v))
            {
                return Enumerable.Empty<T>();
            }
            return v.Split(new string[] { ",", "，", " ", "\n", "\t" },
                     StringSplitOptions.RemoveEmptyEntries).Where(s => !string.IsNullOrWhiteSpace(s)).Select(d => (T)Convert.ChangeType(d.Trim(), typeof(T)));
        }
    }
    class StringUtil
    {
    }
}
